import { React, useRef } from 'react';
import './feedback.css';
import '../../index.css';
import axios from 'axios';
import InterIP from '../../IP/IP'
import { message } from 'antd';

export default function Feedback() {
    var userID = document.cookie.slice(5);

    let IP = InterIP().props.children;
    const feedback_text = useRef();
    function submit() {
        axios.post("http://" + IP + ":3000/user/feedback", {
            opinion: feedback_text.current.value,
            user_id: userID
        })
            .then((res) => {
                message.success(res.data.msg);
            }
            )
    }

    return (
        <div id="feedback">
            <div className="mybill_top"><span>意见反馈</span></div>
            <div>
                <textarea ref={feedback_text} className="feedback_text" placeholder="请输入你的意见我们将期待与您共同成长"  ></textarea>
            </div>
            <button className="feedback_qu">取消</button>
            <button onClick={submit} className="feedback_ti">提交</button>
        </div>
    )
}
